<script>
    var availableTags = ["<?php echo $autocompleteAvailableTags ?>"];
</script>
    <h2>Alege tema</h2>
    <div class="topActions">
        <?php echo $this->Form->create( null, array( "type" => "get", "class" => "searchForm" ) ); ?>
        <div class="searchDiv">
            <?php echo $this->Form->input( "keyword", array(
                "label" => false,
                'div' => false,
                'value' => $keyword,
                "class" => "searchBox",
                "id" => "subiecte_interes",
                "placeholder" => "Subiecte de interes"
            ) ); ?>
            <i class="fa fa-search"></i>
        </div>
        <div class="filterButton">
            <i class="fa fa-filter"></i>
            <?php echo $this->Form->submit( 'Filtreaza', array( "div" => false ) ); ?>
        </div>
        <?php echo $this->Form->end(); ?>
        <div style="clear: both;"></div>
    </div>
    <div id="accordion">
        <?php if( count( $profs ) > 0 ) : ?>
            <?php foreach( $profs as $p ) : ?>
                <?php $prof = $p['User']; ?>
                <h3><?php echo $prof['nume'] . " " . $prof['prenume'] ?></h3>
                <div>
                    <?php if( count( $p['UnapprovedThemes'] ) > 0 ) : ?>
                        <?php foreach( $p['UnapprovedThemes'] as $theme ) : ?>
                            <div class="list_item">
                                <h4><?php echo $theme['name']; ?> <?php echo $this->Html->link( "Inscrie-te", array(
                                    "controller" => "students",
                                    "action"     => "inscriere_tema",
                                    $theme['id']
                                ) ); ?></h4>
                                <div><?php echo $theme['description']; ?></div>
                            </div>
                        <?php endforeach; ?>
                    <?php else : ?>
                        <div>
                            <p>Profesorul acesta nu are nicio tema</p>
                        </div>
                    <?php endif; ?>
                </div>
            <?php endforeach; ?>
        <?php else: ?>
            Niciun profesor gasit!
        <?php endif; ?>
    </div>
<?php echo $this->Paginator->numbers(); ?>